import { createRouter, createWebHistory } from 'vue-router'

const chilRoute = [
    {
        path: "/dashboard",
        name: "dashboard",
        component: () =>
            import ("@/views/Dashboard.vue")
    },
    {
        path: "/user",
        name: "user",
        component: () =>
            import ("@/views/UserList.vue")
    }
];

//4 :定义路由配置规则
const routes = [
    {
        path: "/login",
        name: "login",
        component: () =>
            import ("@/views/Login.vue")
    },
    {
        path: "/",
        name: "adminIndex",
        component: () =>
            import ("@/views/Index.vue"),
        children: chilRoute
    }
]


//2 :创建路由对象
const router = createRouter({
    // 引入访问模式
    history: createWebHistory(),
    routes
})



// 3: 导出即可生效
export default router